package com.baijiayun.sdk.core;

import com.google.common.base.CaseFormat;

public class AddressUtil {

    /**
     * 获取接口地址
     *
     * @param cls
     * @param <T>
     * @return
     */
    public static <T> String getJsonAddr(Class<T> cls) {
        String pkgName = cls.getPackage().getName();
        String className = cls.getSimpleName();
        int dot = className.toLowerCase().indexOf("service");
        className = className.substring(0, dot);
        return "/openapi/" + CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, className);
    }
}
